package cn.gxljc.technology.store_management.mapper;

import cn.gxljc.technology.store_management.entity.WarehouseOutbound;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.sql.Timestamp;
import java.util.List;

/*
 **@author LuoShengYing
 **@date 2021/6/19
 * WarehouseOutboundMapper用于管理WarehouseOutbound(仓库出库)表
 */
@Mapper
public interface WarehouseOutboundMapper {

    // 通过warehouseID，查询该仓库的全部出库信息
    @Select("select * from `warehouseoutbound` where `warehouseID` = #{warehouseID}")
    List<WarehouseOutbound> selectOutboundByWarehouseID(int warehouseID);

    // 通过orderID，查询该订单的出库信息
    @Select("select * from `warehouseoutbound` where `orderID` = #{orderID}")
    WarehouseOutbound selectOutboundByWareID(int orderID);

    // 新增出库信息，并返回boolean类型数据显示成功与否
    @Insert("insert `warehouseoutbound` set `warehouseID` = #{warehouseID}, `orderID` = #{orderID}, `outboundTime` = #{outboundTime}")
    boolean insertOutbound(WarehouseOutbound outbound);

    // 删除出库信息，并返回boolean类型数据显示成功与否
    @Delete("delete from `warehouseoutbound` where `orderID` = #{orderID}")
    boolean deleteOutbound(int orderID);
}
